package com.lingyue.entity.module.es.doc;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;

/**
 * @version 1.0.0
 * @author: lzy
 * @date: 2019/12/3 14:11
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@Document(indexName = "new_customer" ,shards = 3, type = "_doc")
public class EsCustomerDocument {

    @Id
    @Field(value = "id", type = FieldType.Long)
    @JsonSerialize(using= ToStringSerializer.class)
    private Long id;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_API_UNIQUE_KEY , 描述: 客户接口唯一码}")
    @Field(value = "uniqueKey", type = FieldType.Keyword)
    private String uniqueKey;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_DEL_ID , 描述: 经销商ID}")
    @Field(value = "dealerId", type = FieldType.Long)
    private Long dealerId;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_CUSTOMER_ID , 描述: 客户编码}")
    @Field(value = "customerId", type = FieldType.Keyword)
    private String customerId;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_DATA_PRIVACY , 描述: 客户类别：同意使用数据: Y/N:默认 (*Rejected data privacy leads won’t be sent)}")
    @Field(value = "dataPrivacy", type = FieldType.Keyword)
    private String dataPrivacy;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_SA_NAME , 描述: 销售顾问姓名(称呼)}")
    @Field(value = "saName", type = FieldType.Keyword)
    private String saName;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_NAME , 描述: 客户姓名}")
    @Field(value = "customerName", type = FieldType.Keyword)
    private String customerName;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_GENDER , 描述: 性别: M:男生/F:女士}")
    @Field(value = "gender", type = FieldType.Keyword)
    private String gender;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_DOB , 描述: 客户生日}")
    @Field(value = "birthday", type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date birthday;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_MOBILE , 描述: 手机号}")
    @Field(value = "mobile", type = FieldType.Keyword)
    private String mobile;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_MOBILE_SPARE , 描述: 备用手机号}")
    @Field(value = "mobileSpare", type = FieldType.Keyword)
    private String mobileSpare;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_CITY , 描述: 城市}")
    @Field(value = "city", type = FieldType.Keyword)
    private String city;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_EMAIL , 描述: E-MAIL}")
    @Field(value = "email", type = FieldType.Keyword)
    private String email;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_COMPANY , 描述: 公司}")
    @Field(value = "company", type = FieldType.Keyword)
    private String company;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_VEH_INTEREST , 描述: 感兴趣车型}")
    @Field(value = "interestedModels", type = FieldType.Keyword)
    private String interestedModels;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_OVERALL_COMMENTS , 描述: 学历行业}")
    @Field(value = "overallComments", type = FieldType.Text)
    private String overallComments;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_SATISFACTION , 描述: 客户安全状态（S - Satisfied/N – Neutral/D – Dissatisfied）}")
    @Field(value = "satisfaction", type = FieldType.Keyword)
    private String satisfaction;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_TD_COMMENTS , 描述: 试驾备注信息}")
    @Field(value = "tdComments", type = FieldType.Text)
    private String tdComments;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_OPEN_COMPLAINTS , 描述: May contain line break / tags}")
    @Field(value = "openComplaints", type = FieldType.Text)
    private String openComplaints;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_KR_BLOCK , 描述: 宝马黑名单}")
    @Field(value = "krBlock", type = FieldType.Keyword)
    private String krBlock;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_DATA_SOURCE , 描述: 客户数据来源:导入/自定义}")
    @Field(value = "dataSource", type = FieldType.Keyword)
    private String dataSource;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_VALID_FLAG , 描述: 是否有效数据:Y/N}")
    @Field(value = "valid", type = FieldType.Keyword)
    private String valid;

    @ApiModelProperty(value = "{表: CUSTOMER , 字段名: CUS_CREATE_DATE , 描述: 客户创建时间}")
    @Field(value = "createDate", type = FieldType.Date, format = DateFormat.custom, pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createDate;
}
